load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target")
load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")
load("@fbsource//tools/build_defs/dirsync:fb_dirsync_cpp_library.bzl", "fb_dirsync_cpp_library")
load("@fbsource//xplat/pfh/triage_InfrastructureSupermoduleOptou:DEFS.bzl", "triage_InfrastructureSupermoduleOptou")
load("../defs.bzl", "folly_xplat_library")

oncall("fbcode_entropy_wardens_folly")

# xplat build rules

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "init",
    srcs = [
        "Init.cpp",
    ],
    fbcode_deps = [
        "fbcode//folly/experimental/symbolizer:signal_handler",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Init.h",
    ],
    deps = [
        "fbsource//xplat/folly/experimental/symbolizer:symbolizer",
        "fbsource//xplat/folly/logging:init",
        "fbsource//xplat/folly/portability:config",
        "fbsource//xplat/folly/portability:gflags",
        "fbsource//xplat/folly/portability:sys_syscall",
        ":phase",
        "//third-party/glog:glog",
        "//xplat/folly:portability",
        "//xplat/folly:singleton",
        # "fbsource//xplat/folly/synchronization:hazptr_thread_pool_executor",
        "//xplat/folly:synchronization_hazptr_thread_pool_executor",
    ],
)

# fbcode build rules

fbcode_target(
    _kind = cpp_library,
    name = "init",
    srcs = ["Init.cpp"],
    headers = ["Init.h"],
    deps = [
        ":phase",
        "//folly:singleton",
        "//folly/experimental/symbolizer:signal_handler",
        "//folly/logging:init",
        "//folly/portability:config",
        "//folly/portability:gflags",
        "//folly/synchronization:hazptr_thread_pool_executor",
    ],
    exported_deps = [
        "//folly:portability",
    ],
    external_deps = [
        "glog",
    ],
)

fb_dirsync_cpp_library(
    name = "phase",
    srcs = ["Phase.cpp"],
    headers = ["Phase.h"],
    feature = triage_InfrastructureSupermoduleOptou,
    xplat_impl = folly_xplat_library,
)
